import { createRouter, createWebHashHistory } from 'vue-router';

import Layout from '@/layouts/index.vue';

export const routes = [{
        path: '/login',
        component: () =>
            import ('@/views/login/index.vue'),
        hidden: true
    },

    {
        path: '/404',
        component: () =>
            import ('@/views/404.vue'),
        hidden: true
    },


    {
        path: '/',
        component: Layout,
        redirect: '/home',
        children: [{
            path: 'home',
            name: 'home',
            meta: { title: '首页', icon: 'el-icon-s-home' },
            component: () =>
                import ('views/home/index.vue')
        }]
    },
    {
        path: "/test",
        name: 'test',
        component: Layout,
        redirect: '/test/test1',
        meta: { title: "会员列表", icon: "el-icon-location" },
        children: [{
                path: "test1",
                name: "test1",
                component: () =>
                    import ("views/home/test.vue"),
                meta: { title: "实名认证通过" },
            },
            {
                path: "test2",
                name: "test2",
                component: () =>
                    import ("views/home/test.vue"),
                meta: { title: "实名认证未通过" },
            },
            {
                path: "test3",
                name: "test3",
                component: () =>
                    import ("views/home/test.vue"),
                meta: { title: "高级实名待审核" },
            },

        ],
    },
    {
        path: "/:catchAll(.*)",
        name: "404",
        redirect: '/404'
    }
]

// 使用工厂函数createRouter 来创建router实例
const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router